const Router = require('koa-router')
const router = new Router({ prefix:"/api/carts" })
const { auth } = require('../middleware/auth.middleware')
const { validator } = require('../middleware/carts.middleware')
const { add, findAll, deleteCart} = require('../controller/carts.controller')

// 添加或更新商品到购物车
router.post("/",validator,add)
//购物车列表
router.get("/",  findAll)
// 删除购物车商品
 router.delete("/:id", auth, deleteCart)
module.exports = router